<template>
  <div class="box">
    <h1>Child1{{ num }}</h1>
    <button @click="updataPar">修改父组件的count数据</button>
  </div>
</template>

<script>
export default {
  name: "Child1",
  data() {
    return {
      num: 0,
    };
  },
  methods: {
    updataPar() {
      console.log(this.$parent);
      this.$parent.count += 2;
    },
  },
};
</script>

<style scoped>
.box {
  background: yellowgreen;
}
</style>
